import java.util.*;

/**
 * Created with IntelliJ IDEA.
 * Description: 找公共祖先
 * User: 86187
 * Date: 2022-10-20
 * Time: 22:43
 */
public class Test {
    public static int getLCA(int a, int b) {
        // write code here
        while(a != b)
        {
            if(a > b)
                a /= 2;
            else
                b /= 2;
        }
        return a;
    }

    public static void main(String[] args) {

        System.out.println(getLCA(3, 4));

    }
}
